BODY | NN n/a IE 4 DOM 1 | ||
The BODY object reflects the BODY element, which is distinct from the document object. The BODY object refers to just the element and its nested content. The BODY object is special in IE 4 in that it is the gateway to many important visual aspects of content on the page, such as background, margins, and scrolling. There is a shortcut reference to the object, document.body, so you don't have to build a reference via the document.all.elementID hierarchy. | |||
HTML Equivalent<BODY> | |||
Object Model Reference
|
accessKey | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
A single character key that brings focus to an element. The browser
and operating system determine whether the user must press a modifier
key (e.g., | |||
Exampledocument.body.accessKey = "n" | |||
Value Single alphanumeric (and punctuation) keyboard character. | |||
|
aLink | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
Color of a hypertext link as it is being clicked. The color is applied to the link text or border around an image or object embedded within an A element. See also link and vLink properties for unvisited and visited link colors. Navigator's corresponding property is alinkColor of the document object. | |||
Exampledocument.body.aLink = "green" | |||
Value A hexadecimal triplet or plain-language color name. |
|||
|
background | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
URL of the background image for the entire document. If you set a bgColor to the element as well, the color appears if the image fails to load; otherwise, the image overlays the color. | |||
Exampledocument.body.background = "images/watermark.jpg" | |||
Value Complete or relative URL to the background image file. | |||
|
bgColor | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
Background color of the element. Even if the BGCOLOR attribute or bgColor property is set with a plain-language color name, the returned value is always a hexadecimal triplet. | |||
Exampledocument.body.bgColor = "yellow" | |||
Value A hexadecimal triplet or plain-language color name. |
|||
|
bgProperties | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Whether the background image remains in a fixed position or scrolls as a user scrolls the page. When the background image is set to remain in a fixed position, scrolled content flows past the background image very much like film credits roll past a background image on the screen. | |||
Exampledocument.body.bgProperties = "fixed" | |||
Value Case-insensitive constant string values: fixed | scroll. | |||
|
bottomMargin | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
The amount of blank space between the very end of content and the bottom of a scrollable page. The setting has no visual effect if the length of the content or size of the window does not cause the window to scroll. The default value is for the end of content to be flush with the end of the document, but in the Macintosh version of Internet Explorer 4, there is about a 10-pixel margin visible even when the property is set to zero. Larger sizes are reflected properly. This property offers somewhat of a shortcut or alternate to setting the marginBottom style sheet property for the BODY element object. | |||
Exampledocument.body.bottomMargin = 20 | |||
Value An integer value (zero or greater) of the number of pixels of clear space at the bottom of the document. | |||
|
clientHeight, clientWidth | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
According to Microsoft's developer documentation, these properties reflect the height and width (in pixels) of the element's content. | |||
Examplevar midHeight = document.body.clientHeight/2 | |||
Value Integer pixel value. | |||
|
clientLeft, clientTop | NN n/a IE 4 DOM n/a | ||
Read-only | |||
According to Microsoft's developer documentation, these properties reflect the distance between the "true" left and top edges of the document area and the edges of the element. To get or set the pixel position of an element in the document, use the pixelLeft and pixelTop properties. | |||
Value A string value for a length in a variety of units or percentage. | |||
|
leftMargin | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Width in pixels of the left margin of the BODY element in the browser window or frame. By default, the browser inserts a small margin to keep content from abutting the left edge of the window. Setting the property to an empty string is the same as setting it to zero. | |||
Exampledocument.body.leftMargin = 16 | |||
Value Integer of pixel count. | |||
|
link | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
The color of a hypertext link that has not been visited (that is, the URL of the link is not in the browser's cache). This is one of three states for a link: unvisited, activated, and visited. The color is applied to the link text or border around an image or object embedded within an A element. This property has the same effect as setting the document object's linkColor property. | |||
Exampledocument.body.link = "#00FF00" | |||
Value A hexadecimal triplet or plain-language color name. |
|||
|
noWrap | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
Whether the browser should render the body content as wide as is necessary to display a line of nonbreaking text on one line. Abuse of this attribute can force the user into a great deal of inconvenient horizontal scrolling of the page to view all of the content. | |||
Exampledocument.body.noWrap = "true" | |||
Value Boolean value: true | false. | |||
|
recordNumber | NN n/a IE 4 DOM n/a | ||
Read-only | |||
Used with data binding, returns an integer representing the record within the data set that generated the element). Values of this property can be used to extract a specific record from an Active Data Objects (ADO) record set (see recordset property). | |||
Example<SCRIPT FOR="tableTemplate" EVENT="onclick"> myDataCollection.recordset.absoluteposition = this.recordNumber ... </SCRIPT> | |||
Value Integer. | |||
|
rightMargin | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Width in pixels of the right margin of the BODY element in the browser window or frame. By default, the browser inserts a small margin to keep content from abutting the right edge of the window (except on the Macintosh). Setting the property to an empty string is the same as setting it to zero. | |||
Exampledocument.body.leftMargin = 16 | |||
Value Integer of pixel count. | |||
|
scroll | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Whether the window (or frame) displays scrollbars when the content exceeds the window size. | |||
Exampledocument.body.scroll = "no" | |||
Value Not exactly a Boolean value. Requires one of the following string values: yes | no. | |||
|
scrollHeight, scrollWidth | NN n/a IE 4 DOM n/a | ||
Read-only | |||
The meaning of these two properties is ambiguous based on Microsoft's description and the way they're implemented in the Windows and Macintosh versions of Internet Explorer 4. My best guess is that these properties are intended to measure the height and width (in pixels) of the content of an element, even when some of the content cannot be seen unless scrolled with scrollbars. The Macintosh version of the browser interprets this to mean the amount of the content that you can see at any one time. The important point is that for key elements, such as the BODY, the properties mean different things and can disrupt cross-platform operation. | |||
Examplevar midPoint = document.body.scrollHeight/2 | |||
Value Positive integer or zero. | |||
|
scrollLeft, scrollTop | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
The distance in pixels between the actual left or top edge of the element's physical content and the left or top edge of the visible portion of the content. Setting these properties allows you to use a script to adjust the scrolling of content within a scrollable container, such as text in a TEXTAREA element or an entire document in the browser window or frame. When the content is not scrolled, both values are zero. Setting the scrollTop property to 15 scrolls the document upward by 15 pixels in the window; the scrollLeft property is unaffected unless explicitly changed. The property values change as the user adjusts the scrollbars. | |||
Exampledocument.body.scrollTop = 40 | |||
Value Positive integer or zero. | |||
|
tabIndex | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
A number that indicates the sequence of this element within the tabbing order of all focusable elements in the document. Tabbing order follows a strict set of rules. Elements that have values other than zero assigned to their tabIndex properties are first in line when a user starts tabbing in a page. Focus starts with the element with the lowest tabIndex value and proceeds in order to the highest value, regardless of physical location on the page or in the document. If two elements have the same tabIndex values, the element that comes earlier in the document receives focus first. Next come all elements that either don't support the tabIndex property or have the value set to zero. These elements receive focus in the order in which they appear in the document. A value of -1 removes the element from tabbing order altogether. Note that the Macintosh user interface does not provide for giving focus to elements other than text and password INPUT fields. | |||
Exampledocument.body.tabIndex = 0 | |||
Value Integer. | |||
|
text | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
The color of text for the entire document body. Equivalent to the foreground color. | |||
Exampledocument.body.text = "darkred" | |||
Value A hexadecimal triplet or plain-language color name. |
|||
|
topMargin | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Width in pixels of the top margin of the BODY element in the browser window or frame. By default, the browser inserts a small margin to keep content from abutting the top edge of the window. Setting the property to an empty string is the same as setting it to zero. | |||
Exampledocument.body.topMargin = 16 | |||
Value Integer of pixel count. | |||
|
vLink | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
Color of a hypertext link that has been visited recently. The color is applied to the link text or border around an image or object embedded within an A element. See also link and aLink properties for unvisited and clicked link colors. Navigator's corresponding property is vlinkColor of the document object. | |||
Exampledocument.body.vLink = "gold" | |||
Value A hexadecimal triplet or plain-language color name. |
|||
|
createTextRange( ) | NN n/a IE 4 DOM n/a |
Creates a TextRange object from the source code of the current element. See the TextRange object for details. | |
Returned Value TextRange object. | |
Parameters None. |